package collection;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Random;

public class SortIntegerDemo {
    public static void main(String[] args) {
        Random random = new Random();
        List<Integer> l=new ArrayList<>();
        for (int i=0;i<10;i++){
            l.add(0, random.nextInt(100));
        }
        System.out.println(l);
        Collections.sort(l);//小到大排序
        System.out.println("小到大排序"+l);

        Collections.reverse(l);
        System.out.println("翻转排序"+l);
        System.out.println("输出反转后第一元素"+l.get(0));
        Collections.sort(l);
        System.out.println(l);
    }
}
